﻿<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>
<!-- saved from url=(0033)http://research.microsoft.com/pex -->
<head><link rel="StyleSheet" href="er.common.css" type="text/css" /><script src="er.common.js" type="text/javascript"> </script><link rel="SHORTCUT ICON" href="favicon.ico" /><link rel="icon" href="favicon.ico" type="image/x-icon" /><title>C:\Users\AO\Documents\Visual Studio 2010\AutomaTones3\automatones\AutomaTones\AutomaTones\Model\MIDI\Tempo.cs</title></head><body><div class="banner"></div><h2 id="top">C:\Users\AO\Documents\Visual Studio 2010\AutomaTones3\automatones\AutomaTones\AutomaTones\Model\MIDI\Tempo.cs</h2><div class="toggle"><p class="copyright"><a class="usercodeundertestcovered">user code under test</a>, 
  <span class="usercodeundertestnotcovered">user code under test (not covered)</span>, 
  <a class="userortestcodecovered">user code or test</a>, 
  <span class="userortestcodenotcovered">user code or test (not covered)</span>,
  <span class="tagged">tagged</span></p><table><tr><th>Methods</th></tr><tr><th /></tr></table><div class="toggle"><a class="button" href="#ID0EL">first</a><pre class="coverage">using System.Diagnostics.Contracts;
using Microsoft.Pex.Framework;

namespace AutomaTones.Model.MIDI
{
    /// &lt;summary&gt;
    /// Class the can translate a musical format of time (Beats Per Minute) to milliseconds used by Threads.
    /// Instanciate with a BPM and then call the methods to get the corrects value in milliseconds for the called subdivision.
    /// &lt;/summary&gt;
    /// &lt;author&gt;Anders Bech Mellson, anbh@itu.dk&lt;/author&gt;
    [PexClass]
    public class Tempo {
        private readonly int _bpm;

        /// &lt;summary&gt;
        /// Creates a tempo object with the desired tempo in Beats per minute.
        /// &lt;/summary&gt;
        /// &lt;param name="BPM"&gt;&lt;/param&gt;
        <span id="ID0EL"><a class="button" href="#top">top</a></span><a class="userortestcodecovered">public Tempo(int BPM)</a> <a class="userortestcodecovered">{</a>
            Contract.Requires(BPM&gt;0);
            <a class="userortestcodecovered">this._bpm = BPM;</a>
        <a class="userortestcodecovered">}</a>

        /// &lt;summary&gt;
        /// Return the current BPM.
        /// &lt;/summary&gt;
        [PexMethod]
        public int BPM() {
            return _bpm;
        }

        /// &lt;summary&gt;
        /// Returns the value of a wholenote in milliseconds.
        /// &lt;/summary&gt;
        [PexMethod]
        public int WholeNote() {
            return 240000/_bpm;
        }

        /// &lt;summary&gt;
        /// Returns the value of a halfnote in milliseconds.
        /// &lt;/summary&gt;
        [PexMethod]
        public int HalfNote() {
            return 120000/_bpm;
        }

        /// &lt;summary&gt;
        /// Returns the value of a quarternote in milliseconds.
        /// &lt;/summary&gt;
        [PexMethod]
        public int QuarterNote() {
            return 60000/_bpm;
        }

        /// &lt;summary&gt;
        /// Returns the value of a eightnote in milliseconds.
        /// &lt;/summary&gt;
        [PexMethod]
        public int EighthNote() {
            return 30000/_bpm;
        }

        /// &lt;summary&gt;
        /// Returns the value of a sixteenthnote in milliseconds.
        /// &lt;/summary&gt;
        [PexMethod]
        public int SixteenthNote() {
            return 15000/_bpm;
        }

        /// &lt;summary&gt;
        /// Returns the value of a thirtysecondnote in milliseconds.
        /// &lt;/summary&gt;
        [PexMethod]
        public int ThirtySecondNote() {
            return 7500/_bpm;
        }
    }
}
</pre></div></div><hr /><table width="100%"><tr><td valign="top"><span class="copyright">Copyright (c) Microsoft Corporation. All rights reserved.</span><br /><span class="button" onclick="copySourceToClipboard()">Copy full source to clipboard</span></td></tr></table><div id="debugdiv"> </div></body></html>